home *** CD-ROM | disk | FTP | other *** search
/ Mac Power 1997 December / MACPOWER-1997-12.ISO.7z / MACPOWER-1997-12.ISO / AMUG / PROGRAMMING / Raven 1.2 Examples.sit / Raven 1.2 Examples / Quill / Source / PicturePaneEditor.cpp < prev    next >
Text File  |  1997-09-08  |  4KB  |  136 lines

  1. /*
  2.  *  File:       PicturePaneEditor.cpp
  3.  *  Summary:       A view that knows how to edit a TPicturePane.
  4.  *  Written by: Jesse Jones
  5.  *
  6.  *  Copyright ゥ 1997 Jesse Jones. 
  7.  *    For conditions of distribution and use, see copyright notice in ZTypes.h  
  8.  *
  9.  *  Change History (most recent first):    
  10.  *
  11.  *         <1>     9/08/97    JDJ        Created
  12.  */
  13.  
  14. #include "PicturePaneEditor.h"
  15.  
  16. #include <ZControl.h>
  17. #include <ZTextBox.h>
  18.  
  19.  
  20. // ===================================================================================
  21. //    class CPicturePaneCommand
  22. // ===================================================================================
  23.  
  24. //---------------------------------------------------------------
  25. //
  26. // CPicturePaneCommand::~CPicturePaneCommand
  27. //
  28. //---------------------------------------------------------------
  29. CPicturePaneCommand::~CPicturePaneCommand()
  30. {
  31. }
  32.  
  33.  
  34. //---------------------------------------------------------------
  35. //
  36. // CPicturePaneCommand::CPicturePaneCommand
  37. //
  38. //---------------------------------------------------------------
  39. CPicturePaneCommand::CPicturePaneCommand(TPicturePane* pane, const SPicturePaneInfo& oldInfo, const SPicturePaneInfo& newInfo) : Inherited(pane, oldInfo, newInfo)
  40. {
  41. }
  42.  
  43.  
  44. //---------------------------------------------------------------
  45. //
  46. // CPicturePaneCommand::UpdatePane
  47. //
  48. //---------------------------------------------------------------
  49. void CPicturePaneCommand::UpdatePane(const SPicturePaneInfo& info)
  50. {
  51.     mPane->SetPicture(info.id);
  52.     mPane->SetDrawFrame(info.drawFrame);
  53.     mPane->EnableScalingWarning(info.warnIfScaling);
  54. }
  55.  
  56. #pragma mark -
  57.  
  58. // ===================================================================================
  59. //    CPicturePaneEditor
  60. // ===================================================================================
  61.  
  62. static TReanimatorRegister<CPicturePaneEditor> sPicturePaneEditorRegistrar;
  63.  
  64. //---------------------------------------------------------------
  65. //
  66. // CPicturePaneEditor::~CPicturePaneEditor
  67. //
  68. //---------------------------------------------------------------
  69. CPicturePaneEditor::~CPicturePaneEditor()
  70. {
  71. }
  72.  
  73.  
  74. //---------------------------------------------------------------
  75. //
  76. // CPicturePaneEditor::CPicturePaneEditor
  77. //
  78. //---------------------------------------------------------------
  79. CPicturePaneEditor::CPicturePaneEditor(TView* superView) : Inherited(superView)
  80. {
  81. }
  82.  
  83.  
  84. //---------------------------------------------------------------
  85. //
  86. // CPicturePaneEditor::Create                            [static]
  87. //
  88. //---------------------------------------------------------------
  89. MReanimatable* CPicturePaneEditor::Create(MReanimatable* parent)
  90. {
  91.     return new CPicturePaneEditor(dynamic_cast<TView*>(parent));
  92. }
  93.  
  94.  
  95. //---------------------------------------------------------------
  96. //
  97. // CPicturePaneEditor::GetEditorInfo        
  98. //
  99. //---------------------------------------------------------------
  100. SPicturePaneInfo CPicturePaneEditor::GetEditorInfo() const
  101. {
  102.     SPicturePaneInfo info;
  103.     
  104.     TTextBox* color = dynamic_cast<TTextBox*>(this->FindSubPane("ID"));
  105.     info.id = color->GetValue();
  106.     
  107.     TControl* control = dynamic_cast<TControl*>(this->FindSubPane("Draw Frame"));
  108.     info.drawFrame = control->GetValue();
  109.     
  110.     control = dynamic_cast<TControl*>(this->FindSubPane("Warn"));
  111.     info.warnIfScaling = control->GetValue();
  112.     
  113.     return info;
  114. }
  115.  
  116.  
  117. //---------------------------------------------------------------
  118. //
  119. // CPicturePaneEditor::SetEditorInfo
  120. //
  121. //---------------------------------------------------------------
  122. void CPicturePaneEditor::SetEditorInfo(const SPicturePaneInfo& info)
  123. {
  124.     TTextBox* color = dynamic_cast<TTextBox*>(this->FindSubPane("ID"));
  125.     color->SetValue(info.id);
  126.     
  127.     TControl* control = dynamic_cast<TControl*>(this->FindSubPane("Draw Frame"));
  128.     control->SetValue(info.drawFrame);
  129.     
  130.     control = dynamic_cast<TControl*>(this->FindSubPane("Warn"));
  131.     control->SetValue(info.warnIfScaling);
  132. }
  133.  
  134.  
  135.  
  136.